home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / AppsToGo / AppsToGo.src / DTS.StyleChat / WindowPalette.c < prev   
Encoding:
C/C++ Source or Header  |  1993-06-18  |  6.8 KB  |  292 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        WindowPalette.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1990-1993 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19.  
  20.  
  21. /*****************************************************************************/
  22.  
  23.  
  24.  
  25. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  26. #include "App.protos.h"        /* Get the prototypes for application.            */
  27.  
  28. #ifndef __ERRORS__
  29. #include <Errors.h>
  30. #endif
  31.  
  32. #ifndef __UTILITIES__
  33. #include "Utilities.h"
  34. #endif
  35.  
  36.  
  37.  
  38. /*****************************************************************************/
  39.  
  40.  
  41.  
  42. extern short        gPrintPage;                /* Non-zero means we are printing. */
  43.                                             /* DTS.Lib..framework global. */
  44.  
  45. extern RgnHandle    gCursorRgn;                /* We handle cursors here, so we need */
  46. extern CursPtr        gCursorPtr;                /* to know about these things. */
  47.                                             /* Above are DTS.Lib..framework globals. */
  48.  
  49.  
  50.  
  51. /*****************************************************************************/
  52. /*****************************************************************************/
  53.  
  54.  
  55.  
  56. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  57. /* See CalcFrameRgn() for info. */
  58.  
  59. #pragma segment TheDoc
  60. void    PaletteCalcFrameRgn(FileRecHndl frHndl, WindowPtr window, RgnHandle rgn)
  61. {
  62. #pragma unused (frHndl, window, rgn)
  63. }
  64.  
  65.  
  66.  
  67. /*****************************************************************************/
  68.  
  69.  
  70.  
  71. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  72. /* See ContentClick() for info. */
  73.  
  74. #pragma segment TheDoc
  75. void    PaletteContentClick(WindowPtr window, EventRecord *event, Boolean firstClick)
  76. {
  77. #pragma unused (firstClick)
  78.  
  79.     ControlHandle    ctl;
  80.     short            action, cnum;
  81.  
  82.     cnum = IsCtlEvent(window, event, &ctl, &action);
  83.     return;
  84. }
  85.  
  86.  
  87.  
  88. /*****************************************************************************/
  89.  
  90.  
  91.  
  92. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  93. /* See ContentKey() for info. */
  94.  
  95. #pragma segment TheDoc
  96. Boolean    PaletteContentKey(WindowPtr window, EventRecord *event, Boolean *passThrough)
  97. {
  98. #pragma unused (passThrough)
  99.  
  100.     short    cnum;
  101.  
  102.     cnum = IsCtlEvent(window, event, nil, nil);
  103.     if (!cnum) {
  104.         *passThrough = true;
  105.         return(false);
  106.     }
  107.  
  108.     return(true);
  109. }
  110.  
  111.  
  112.  
  113. /*****************************************************************************/
  114.  
  115.  
  116.  
  117. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  118. /* See DrawFrame() for info. */
  119.  
  120. #pragma segment TheDoc
  121. void    PaletteDrawFrame(FileRecHndl frHndl, WindowPtr window, Boolean activate)
  122. {
  123.     MoveTo(0, (*frHndl)->fileState.topSidebar - 1);
  124.     LineTo((*frHndl)->fileState.leftSidebar - 1 - 16384, (*frHndl)->fileState.topSidebar - 1);
  125.     LineTo((*frHndl)->fileState.leftSidebar - 1 - 16384, 16383);
  126.  
  127.     BeginFrame(window);
  128.     DoDrawControls(window, activate);
  129.     EndFrame(window);
  130. }
  131.  
  132.  
  133.  
  134. /*****************************************************************************/
  135.  
  136.  
  137.  
  138. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  139. /* See FreeDocument() for info. */
  140.  
  141. #pragma segment TheDoc
  142. OSErr    PaletteFreeDocument(FileRecHndl frHndl)
  143. {
  144.     return(DefaultFreeDocument(frHndl));
  145. }
  146.  
  147.  
  148.  
  149. /*****************************************************************************/
  150.  
  151.  
  152.  
  153. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  154. /* See FreeWindow() for info. */
  155.  
  156. #pragma segment TheDoc
  157. OSErr    PaletteFreeWindow(FileRecHndl frHndl, WindowPtr window)
  158. {
  159. #pragma unused (frHndl, window)
  160.  
  161.     return(noErr);
  162. }
  163.  
  164.  
  165.  
  166. /*****************************************************************************/
  167.  
  168.  
  169.  
  170. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  171. /* See ImageDocument() for info. */
  172.  
  173. #pragma segment TheDoc
  174. OSErr    PaletteImageDocument(FileRecHndl frHndl)
  175. {
  176. #pragma unused (frHndl)
  177.  
  178.     WindowPtr    curPort;
  179.  
  180.     GetPort(&curPort);
  181.     if (!gPrintPage) {                                    /* If not printing... */
  182.         DoDrawControls(curPort, false);                    /* Draw the content controls. */
  183.     }
  184.  
  185.     return(noErr);
  186. }
  187.  
  188.  
  189.  
  190. /*****************************************************************************/
  191.  
  192.  
  193.  
  194. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  195. /* See InitContent() for info. */
  196.  
  197. #pragma segment TheDoc
  198. OSErr    PaletteInitContent(FileRecHndl frHndl, WindowPtr window)
  199. {
  200.     OSErr    err;
  201.  
  202.     err = AddControlSet(window, (*frHndl)->fileState.sfType, kwStandardVis, 0, 0, nil);
  203.     return(err);
  204. }
  205.  
  206.  
  207.  
  208. /*****************************************************************************/
  209.  
  210.  
  211.  
  212. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  213. /* See ResizeContent() for info. */
  214.  
  215. #pragma segment TheDoc
  216. void    PaletteResizeContent(WindowPtr window, short oldh, short oldv)
  217. {
  218. #pragma unused (window, oldh, oldv)
  219.  
  220.     /* See DTS.Chat for a sample usage of this function. */
  221. }
  222.  
  223.  
  224.  
  225. /*****************************************************************************/
  226.  
  227.  
  228.  
  229. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  230. /* See ScrollFrame() for info. */
  231.  
  232. #pragma segment TheDoc
  233. void    PaletteScrollFrame(FileRecHndl frHndl, WindowPtr window, long dh, long dv)
  234. {
  235. #pragma unused (frHndl, window, dh, dv)
  236. }
  237.  
  238.  
  239.  
  240. /*****************************************************************************/
  241.  
  242.  
  243.  
  244. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  245. /* See UndoFixup() for info. */
  246.  
  247. #pragma segment TheDoc
  248. void    PaletteUndoFixup(FileRecHndl frHndl, Point contOrg, Boolean afterUndo)
  249. {
  250. #pragma unused (frHndl, contOrg, afterUndo)
  251.  
  252.     /* See DTS.Draw for an example of what you might do here. */
  253. }
  254.  
  255.  
  256.  
  257. /*****************************************************************************/
  258.  
  259.  
  260.  
  261. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  262. /* See WindowCursor() for info. */
  263.  
  264. #pragma segment TheDoc
  265. Boolean    PaletteWindowCursor(FileRecHndl frHndl, WindowPtr window, Point globalPt)
  266. {
  267. #pragma unused (frHndl, window, globalPt)
  268.  
  269.     /* For examples of applications that have non-arrow cursor regions,
  270.     ** see DTS.Chat and DTS.Draw. */
  271.  
  272.     DoSetCursor(&qd.arrow);
  273.     return(true);
  274. }
  275.  
  276.  
  277.  
  278. /*****************************************************************************/
  279.  
  280.  
  281.  
  282. /* •• You don't call this.  DTS.Lib..framework does for appropriate document type(s). •• */
  283. /* See WindowGoneFixup() for info. */
  284.  
  285. #pragma segment TheDoc
  286. void    PaletteWindowGoneFixup(WindowPtr window)
  287. {
  288. #pragma unused (window)
  289. }
  290.  
  291.  
  292.